# eric7.QScintilla.Lexers.LexerPygments

Module implementing a custom lexer using pygments.

### Global Attributes

PYGMENTS_ATTRIBUTE
PYGMENTS_BACKTICKSTRING
PYGMENTS_BUILTIN
PYGMENTS_CHAR
PYGMENTS_CLASS
PYGMENTS_COMMENT
PYGMENTS_CONSTANT
PYGMENTS_DECORATOR
PYGMENTS_DEFAULT
PYGMENTS_DELETED
PYGMENTS_DOCSTRING
PYGMENTS_DOUBLESTRING
PYGMENTS_EMPHASIZE
PYGMENTS_ENTITY
PYGMENTS_ERROR
PYGMENTS_ESCAPE
PYGMENTS_EXCEPTION
PYGMENTS_FUNCTION
PYGMENTS_GENERIC_ERROR
PYGMENTS_HASHBANG
PYGMENTS_HEADING
PYGMENTS_HEREDOC
PYGMENTS_INSERTED
PYGMENTS_KEYWORD
PYGMENTS_LABEL
PYGMENTS_LITERAL
PYGMENTS_MULTILINECOMMENT
PYGMENTS_NAMESPACE
PYGMENTS_NUMBER
PYGMENTS_OPERATOR
PYGMENTS_OTHER
PYGMENTS_OUTPUT
PYGMENTS_PREPROCESSOR
PYGMENTS_PROMPT
PYGMENTS_PROPERTY
PYGMENTS_PSEUDOKEYWORD
PYGMENTS_PUNCTUATION
PYGMENTS_REGEX
PYGMENTS_RESERVEDKEYWORD
PYGMENTS_SCALAR
PYGMENTS_SINGLESTRING
PYGMENTS_STRING
PYGMENTS_STRONG
PYGMENTS_SUBHEADING
PYGMENTS_SYMBOL
PYGMENTS_TAG
PYGMENTS_TRACEBACK
PYGMENTS_TYPEKEYWORD
PYGMENTS_VARIABLE
PYGMENTS_WHITESPACE
PYGMENTS_WORD
TOKEN_MAP

### Classes

LexerPygments | Class implementing a custom lexer using pygments.

### Functions

None

## LexerPygments

Class implementing a custom lexer using pygments.

### Derived from

LexerContainer

### Class Attributes

None

### Class Methods

None

### Methods

LexerPygments | Constructor
__guessLexer | Private method to guess a pygments lexer.
boxCommentStr | Public method to return the box comment strings.
canBlockComment | Public method to determine, whether the lexer language supports a block comment.
canBoxComment | Public method to determine, whether the lexer language supports a box comment.
canStreamComment | Public method to determine, whether the lexer language supports a stream comment.
canStyle | Public method to check, if the lexer is able to style the text.
commentStr | Public method to return the comment string.
defaultColor | Public method to get the default foreground color for a style.
defaultEolFill | Public method to get the default fill to eol flag.
defaultFont | Public method to get the default font for a style.
defaultKeywords | Public method to get the default keywords.
defaultPaper | Public method to get the default background color for a style.
description | Public method returning the descriptions of the styles supported by the lexer.
isCommentStyle | Public method to check, if a style is a comment style.
isStringStyle | Public method to check, if a style is a string style.
language | Public method returning the language of the lexer.
name | Public method to get the name of the pygments lexer.
readSettings | Public method to read the lexer settings.
streamCommentStr | Public method to return the stream comment strings.
styleText | Public method to perform the styling.

### Static Methods

None

#### LexerPygments (Constructor)

LexerPygments(parent=None, name="")

Constructor

parent (QWidget)
  parent widget of this lexer
name (str)
  name of the pygments lexer to use

#### LexerPygments.__guessLexer

__guessLexer(text)

Private method to guess a pygments lexer.

text (str)
  text to base guessing on

Return:
  reference to the guessed lexer

Return Type:
  pygments.lexer

#### LexerPygments.boxCommentStr

boxCommentStr()

Public method to return the box comment strings.

Return:
  dictionary containing the start, middle and end box comment strings

Return Type:
  dict of {"start": str, "middle": str, "end": str}

#### LexerPygments.canBlockComment

canBlockComment()

Public method to determine, whether the lexer language supports a block comment.

Return:
  flag indicating block comment is available

Return Type:
  bool

#### LexerPygments.canBoxComment

canBoxComment()

Public method to determine, whether the lexer language supports a box comment.

Return:
  flag box comment is available

Return Type:
  bool

#### LexerPygments.canStreamComment

canStreamComment()

Public method to determine, whether the lexer language supports a stream comment.

Return:
  flag indicating stream comment is available

Return Type:
  bool

#### LexerPygments.canStyle

canStyle()

Public method to check, if the lexer is able to style the text.

Return:
  flag indicating the lexer capability

Return Type:
  bool

#### LexerPygments.commentStr

commentStr()

Public method to return the comment string.

Return:
  comment string

Return Type:
  str

#### LexerPygments.defaultColor

defaultColor(style)

Public method to get the default foreground color for a style.

style (int)
  style number

Return:
  foreground color

Return Type:
  QColor

#### LexerPygments.defaultEolFill

defaultEolFill(style)

Public method to get the default fill to eol flag.

style (int)
  style number

Return:
  fill to eol flag

Return Type:
  bool

#### LexerPygments.defaultFont

defaultFont(style)

Public method to get the default font for a style.

style (int)
  style number

Return:
  font

Return Type:
  QFont

#### LexerPygments.defaultKeywords

defaultKeywords(_kwSet)

Public method to get the default keywords.

_kwSet (int)
  number of the keyword set (unused)

Return:
  string giving the keywords or None

Return Type:
  str

#### LexerPygments.defaultPaper

defaultPaper(style)

Public method to get the default background color for a style.

style (int)
  style number

Return:
  background color

Return Type:
  QColor

#### LexerPygments.description

description(style)

Public method returning the descriptions of the styles supported by the lexer.

style (int)
  style number

Return:
  description for the style

Return Type:
  str

#### LexerPygments.isCommentStyle

isCommentStyle(style)

Public method to check, if a style is a comment style.

style (int)
  style to check

Return:
  flag indicating a comment style

Return Type:
  bool

#### LexerPygments.isStringStyle

isStringStyle(style)

Public method to check, if a style is a string style.

style (int)
  style to check

Return:
  flag indicating a string style

Return Type:
  bool

#### LexerPygments.language

language()

Public method returning the language of the lexer.

Return:
  language of the lexer

Return Type:
  str

#### LexerPygments.name

name()

Public method to get the name of the pygments lexer.

Return:
  name of the pygments lexer

Return Type:
  str

#### LexerPygments.readSettings

readSettings(qs, prefix="/Scintilla")

Public method to read the lexer settings.

Note: Overridden to treat the Pygments lexer specially.

qs (QSettings)
  reference to the settings object
prefix (str (optional))
  prefix for the settings key (defaults to "/Scintilla")

#### LexerPygments.streamCommentStr

streamCommentStr()

Public method to return the stream comment strings.

Return:
  dictionary containing the start and end stream comment strings

Return Type:
  dict of {"start": str, "end": str}

#### LexerPygments.styleText

styleText(_start, end)

Public method to perform the styling.

_start (int)
  position of first character to be styled (unused)
end (int)
  position of last character to be styled

Up